<%-- 
    Document   : index
    Created on : Aug 25, 2014, 1:56:08 PM
    Author     : NGOCLINH-PC
--%>

<%@page import="Data.Member"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="Data.Event"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Data.Category"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<html>
    <head>

        <!-- Page Title -->
        <title>National Lever Paper Presentation</title>

        <!-- Meta Tags -->
        <meta charset="utf-8">
        <meta name="keywords" content="National Lever Paper Presentation" />
        <meta name="description" content="National Lever Paper Presentation">
        <meta name="author" content="Ngoc Linh">

        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <!-- Theme Styles -->
        <link rel="stylesheet" href="css/bootstrap.min.css">
        <link rel="stylesheet" href="css/font-awesome.min.css"> 
        <link href='http://fonts.googleapis.com/css?family=Lato:300,400,700' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="css/animate.min.css">

        <!-- Current Page Styles -->
        <link rel="stylesheet" type="text/css" href="components/revolution_slider/css/settings.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="components/revolution_slider/css/style.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="components/jquery.bxslider/jquery.bxslider.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="components/flexslider/flexslider.css" media="screen" />

        <!-- Main Style -->
        <!--<link id="main-style" rel="stylesheet" href="css/style.css">-->
        <script type="text/javascript">
            var mainStyle = "style.css";
            if (typeof localStorage != "undefined") {
                var colorSkin = localStorage.getItem("colorSkin");
                if (colorSkin != null) {
                    mainStyle = "style-" + colorSkin + ".css";
                }
            }
            // document.write('<link id="main-style" rel="stylesheet" href="http://www.soaptheme.com/html/travelo/css/'&#32;+&#32;mainStyle&#32;+&#32;'">');
        </script>

        <!-- Custom Styles -->
        <link rel="stylesheet" href="css/custom.css">

        <!-- Updated Styles -->
        <link rel="stylesheet" href="css/updates.css">

        <!-- Updated Styles -->
        <link rel="stylesheet" href="css/updates.css">

        <!-- Responsive Styles -->
        <link rel="stylesheet" href="css/responsive.css">

    </head>
    <body>
        <div id="page-wrapper">
            <header id="header" class="navbar-static-top">
                <div class="topnav hidden-xs">
                    <div class="container">
                        <ul class="quick-menu pull-left">
                            <%
                                // String user = (String) session.getAttribute("ssuser");
                                if (session.getAttribute("ssusercl") != null) {
                                    String userclm = (String) session.getAttribute("ssusercl");
                                    if (userclm == "") {
                                    } else {
                                        out.println("<li><a href='index.jsp?page=Profile'>My Account</a></li>");
                                    }
                                }
                            %>

                        </ul>
                        <ul class="quick-menu pull-right">
                            <%
                                String usercl = (String) session.getAttribute("ssusercl");
                                if (usercl == "" || session.getAttribute("ssusercl") == null) {
                                    out.println("<li><a href='index.jsp?page=Login'>LOGIN</a></li>");
                                    out.println("<li><a href='index.jsp?page=Register'>Singup</a></li>");
                                } else {
                                    Member mem = new Member();
                                    ArrayList<Member> pm = mem.MselectByquery("SELECT * FROM Member where Username='" + usercl + "'");
                                    if (pm.size() > 0) {
                                        for (int im = 0; im < pm.size(); im++) {
                                            Member paym = pm.get(im);

                                            out.println("<li style='color:#fff;padding-top: 6px; font-size: 10px;text-transform: uppercase'>Welcome: &nbsp;" + paym.getMemberName() + "</li>");
                                            out.println("<li><a href='Logout.jsp'>Logout</a></li>");
                                        }
                                    }
                                }
                            %>

                        </ul>
                    </div>
                </div>

                <div class="main-header">

                    <a href="index.html#mobile-menu-01" data-toggle="collapse" class="mobile-menu-toggle">
                        Mobile Menu Toggle
                    </a>

                    <div class="container">
                        <h1 class="logo navbar-brand" style="margin: 0 0 0 -20px;">
                            <a href="index.jsp" title="Travelo - home">
                                <img style="opacity: 100;" src="../client/images/logo.png" alt="Travelo HTML5 Template" />
                            </a>
                        </h1>

                        <nav id="main-menu" role="navigation">
                            <ul class="menu">
                                <li class="menu-item-has-children">
                                    <a href="index.jsp">Home</a>
                                </li>

                                <li class="menu-item-has-children">
                                    <a href="index.jsp?page=About">About</a>
                                </li>
                                <li class="menu-item-has-children">
                                    <a href="index.jsp?page=listEvent">Event</a>
                                    <ul>
                                        <%
                                            Category ct = new Category();
                                            ArrayList<Category> a = ct.CselectbyQuery("AND Status=1");

                                            if (a.size() > 0) {
                                                for (int i = 0; i < a.size(); i++) {
                                                    Category cate = a.get(i);
                                                    out.print("<li><a href='index.jsp?page=listEvent&CateID=" + cate.getCategoryID() + "'>" + cate.getCategoryName() + "</a></li>");
                                                }
                                            }
                                        %>

                                    </ul>
                                </li>
                                <li class="menu-item-has-children">
                                    <a href="index.jsp?page=Subcriber">Subcriber</a>
                                </li>
                                <li class="menu-item-has-children">
                                    <a href="index.jsp?page=Contact">Contact</a>
                                </li>

                            </ul>
                        </nav>
                    </div>
                </div>
            </header>
            <%
                if (request.getParameter(
                        "page") != null) {
                    String p = request.getParameter("page");
                    p = p + ".jsp";
            %>
            <jsp:include page="<%=p%>" />
            <%
            } else {
            %>                
            <div id="slideshow" style="height: 580px">
                <div class="fullwidthbanner-container"style="height: 540px">
                    <div  class="revolution-slider" style=" overflow: hidden; height: 0">
                        <ul style="height: 580px; float: left;">    <!-- SLIDE  -->
                            <!-- Slide1 -->
                            <%
                                Date d = new Date();
                                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                                String hientai = sdf.format(d.getTime());
                                Event event2 = new Event();
                                ArrayList<Event> aEvent2 = event2.ESelectbyQuery(" SELECT TOP 5 * FROM Event where 1=1 AND Status=1 ORDER BY TimeEvent DESC");

                                if (aEvent2.size() > 0) {
                                    for (int js = 0; js < aEvent2.size(); js++) {
                                        Event lseventSlide = aEvent2.get(js);
                                        String timeevent1 = lseventSlide.getTimeEvent();
                                        if (timeevent1.compareTo(hientai) >= 0) {
                                            int idslide = lseventSlide.getEventID();
                                            ArrayList<Event> evSlide = event2.ESelectByID(idslide);
                                            if (evSlide.size() > 0) {
                                                for (int jk = 0; jk < evSlide.size(); jk++) {
                                                    Event lsevent1 = evSlide.get(jk);
                                                    out.print("<li data-transition='fade'  data-slotamount='7' data-masterspeed='1500'>");
                                                    out.print("<img src='../uploads/" + lsevent1.getImages() + "' alt='" + lsevent1.getEventName() + "'>");
                                                    out.print("</li>");
                                                }

                                            }
                                        }
                                    }
                                }
                            %>
                        </ul>
                    </div>
                </div>
            </div>

            <section id="content" style="padding: 0;">

                <!-- Popuplar Destinations -->
                <div class="destinations section" style="padding: 20px 0 0 0;" >
                    <div class="container" style="height: 370px; ">
                        <h2><a href="index.jsp?page=EventNew">Event New</a></h2>
                        <div class="block image-carousel style2 flexslider" data-animation="slide" data-item-width="270" data-item-margin="30">
                            <ul class="slides image-box listing-style2">
                                <%
                                    Event event = new Event();
                                    ArrayList<Event> eventnew = event.ESelectbyQuery("SELECT * FROM Event where 1=1 AND Status=1");
                                    if (eventnew.size() > 0) {
                                        for (int j = 0; j < eventnew.size(); j++) {
                                            Event lseventnew = eventnew.get(j);
                                            String timeevent = lseventnew.getTimeEvent();
                                            if (timeevent.compareTo(hientai) >= 0) {
                                                int id = lseventnew.getEventID();
                                                ArrayList<Event> aEvent1 = event.ESelectByID(id);
                                                if (aEvent1.size() > 0) {
                                                    for (int jk = 0; jk < aEvent1.size(); jk++) {
                                                        Event lsevent1 = aEvent1.get(jk);

                                %>

                                <li>
                                    <article class="box">
                                        <figure>
                                            <% out.print("<a href='index.jsp?page=detailEvent&EventID=" + lsevent1.getEventID() + "' class='hover-effect'><img style='width:270px; height:212px;' src='../uploads/" + lsevent1.getImages() + "' alt='' width='270' height='160' /></a>");%>
                                        </figure>
                                        <div class="details">
                                            <% out.print("<a title='View all' href='index.jsp?page=detailEvent&EventID=" + lsevent1.getEventID() + "' class='pull-right button uppercase'>select</a>");%>
                                            <% out.print("<h4 class='box-title'>" + lsevent1.getEventName() + "</h4>");%>
                                            <label class="price-wrapper">
                                                <% out.print("<span class='price-per-unit'>$" + lsevent1.getPrice() + "</span>");%>
                                            </label>
                                        </div>
                                    </article>
                                </li>
                                <%}
                                                }
                                            }
                                        }
                                    }
                                %>
                            </ul>
                        </div>
                    </div>
                    <!--aaaaaaa-->
                    <div class="container" >
                        <h2><a href="index.jsp?page=EventTookplace">Event took place</a></h2>
                        <div class="block image-carousel style2 flexslider" data-animation="slide" data-item-width="270" data-item-margin="30">
                            <ul class="slides image-box listing-style2">
                                <%
                                    ArrayList<Event> eventcu = event.ESelectbyQuery("SELECT * FROM Event where 1=1 AND Status=1");
                                    if (eventcu.size() > 0) {
                                        for (int j = 0; j < eventcu.size(); j++) {
                                            Event lsevent = eventcu.get(j);
                                            String timeevent = lsevent.getTimeEvent();
                                            if (timeevent.compareTo(hientai) < 0) {
                                                int id = lsevent.getEventID();
                                                ArrayList<Event> aEvt = event.ESelectByID(id);
                                                if (aEvt.size() > 0) {
                                                    for (int jk = 0; jk < aEvt.size(); jk++) {
                                                        Event lsev1 = aEvt.get(jk);
                                %>
                                <li>
                                    <article class="box">
                                        <figure>
                                            <% out.print("<a href='index.jsp?page=detailEvent&EventID=" + lsev1.getEventID() + "' class='hover-effect'><img style='width:270px; height:212px;' src='../uploads/" + lsev1.getImages() + "' alt='' width='270' height='160' /></a>");%>
                                        </figure>
                                        <div class="details">
                                            <% out.print("<a title='View all' href='index.jsp?page=detailEvent&EventID=" + lsev1.getEventID() + "' class='pull-right button uppercase'>select</a>");%>
                                            <% out.print("<h4 class='box-title'>" + lsev1.getEventName() + "</h4>");%>
                                            <label class="price-wrapper">
                                                <% out.print("<span class='price-per-unit'>$" + lsev1.getPrice() + "</span>");%>
                                            </label>
                                        </div>
                                    </article>
                                </li>
                                <%}
                                                }
                                            }
                                        }
                                    }
                                %>
                            </ul>
                        </div>

                    </div>
                </div>

            </section>
            <%
                }
            %>
            <footer id="footer">
                <div class="footer-wrapper" style=" padding: 10px;background: #daf8ff">
                    <div class="container">
                        <div class="row">
                            <div class="col-sm-6 col-md-3">
                                <h2>Category</h2>
                                <ul class="discover triangle hover row">
                                    <%
                                        if (a.size() > 0) {
                                            for (int i = 0; i < a.size(); i++) {
                                                Category cate = a.get(i);
                                                out.print("<li class='col-xs-6'><a href='#'>" + cate.getCategoryName() + "</a></li>");
                                            }
                                        }
                                    %>

                                </ul>
                            </div>
                            <div class="col-sm-6 col-md-3">
                                <h2>Event News</h2>
                                <ul class="travel-news">
                                    <%
                                        Event eventf = new Event();
                                        ArrayList<Event> aEventf = eventf.ESelectbyQuery(" SELECT TOP 2 * FROM Event where 1=1 AND Status=1");

                                        if (aEventf.size() > 0) {
                                            for (int j = 0; j < aEventf.size(); j++) {
                                                Event lsevent = aEventf.get(j);
                                                //out.print("<li><a href='#'>" + cate.getCategoryName() + "</a></li>");
                                    %>
                                    <li>
                                        <div class="thumb">
                                            <% out.print("<a href='index.jsp?page=detailEvent&EventID=" + lsevent.getEventID() + "'>");%>
                                            <% out.print("<img  src='../uploads/" + lsevent.getImages() + "' alt='' width='63' height='63' />");%>
                                            <% out.print(" </a>");%>
                                        </div>
                                        <div class="description">
                                            <% out.print("<h5 class='s-title'><a href='index.jsp?page=detailEvent&EventID=" + lsevent.getEventID() + "'>" + lsevent.getEventName() + "</a></h5>");%>
                                            <% out.print("<p>" + lsevent.getDescription() + "</p>");%>
                                            <% out.print("<span class='date'>" + lsevent.getDateCreate() + "</span>");%>
                                        </div>
                                    </li>
                                    <%
                                            }
                                        }
                                    %>

                                </ul>
                            </div>
                            <div class="col-sm-6 col-md-3">
                                <h2>Mailing List</h2>
                                <p>Sign up for our mailing list to get latest updates and offers.</p>
                                <br />
                                <div class="icon-check">
                                    <input type="text" class="input-text full-width" placeholder="your email" />
                                </div>
                                <br />
                                <span>We respect your privacy</span>
                            </div>
                            <div class="col-sm-6 col-md-3">
                                <h2>About Us</h2>
                                <p>Nunc cursus libero purus ac congue arcu cursus ut sed vitae pulvinar massaidp nequetiam lore elerisque.</p>
                                <br />
                                <address class="contact-details">
                                    <span class="contact-phone"><i class="soap-icon-phone"></i> 1-800-123-HELLO</span>
                                    <br />
                                    <a href="#" class="contact-email">Contact@aptech.com</a>
                                </address>
                                <ul class="social-icons clearfix">
                                    <li class="twitter"><a title="twitter" href="#" data-toggle="tooltip"><i class="soap-icon-twitter"></i></a></li>
                                    <li class="googleplus"><a title="googleplus" href="#" data-toggle="tooltip"><i class="soap-icon-googleplus"></i></a></li>
                                    <li class="facebook"><a title="facebook" href="#" data-toggle="tooltip"><i class="soap-icon-facebook"></i></a></li>
                                    <li class="linkedin"><a title="linkedin" href="#" data-toggle="tooltip"><i class="soap-icon-linkedin"></i></a></li>
                                    <li class="vimeo"><a title="vimeo" href="#" data-toggle="tooltip"><i class="soap-icon-vimeo"></i></a></li>
                                    <li class="dribble"><a title="dribble" href="#" data-toggle="tooltip"><i class="soap-icon-dribble"></i></a></li>
                                   
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bottom gray-area">
                    <div class="container">
                        <div class="logo pull-left">
                            <a href="index.html" title="Travelo - home">
                                <img src="images/logo.png" alt="Travelo HTML5 Template" />
                            </a>
                        </div>
                        <div class="pull-right">
                            <a id="back-to-top" href="index.html#" class="animated" data-animation-type="bounce"><i class="soap-icon-longarrow-up circle"></i></a>
                        </div>
                        <div class="copyright pull-right">
                            <p>&copy; Group 263 C1109L Hanoi-Aptech 2014 </p>
                        </div>
                    </div>
                </div>
            </footer>
        </div>
        <!-- Javascript -->
        <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="js/jquery.noconflict.js"></script>
        <script type="text/javascript" src="js/modernizr.2.7.1.min.js"></script>
        <script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>
        <script type="text/javascript" src="js/jquery.placeholder.js"></script>
        <script type="text/javascript" src="js/jquery-ui.1.10.4.min.js"></script>

        <!-- Twitter Bootstrap -->
        <script type="text/javascript" src="js/bootstrap.min.js"></script>

        <!-- load revolution slider scripts -->
        <script type="text/javascript" src="components/revolution_slider/js/jquery.themepunch.plugins.min.js"></script>
        <script type="text/javascript" src="components/revolution_slider/js/jquery.themepunch.revolution.min.js"></script>

        <!-- load BXSlider scripts -->
        <script type="text/javascript" src="components/jquery.bxslider/jquery.bxslider.min.js"></script>

        <!-- Flex Slider -->
        <script type="text/javascript" src="components/flexslider/jquery.flexslider-min.js"></script>

        <!-- parallax -->
        <script type="text/javascript" src="js/jquery.stellar.min.js"></script>

        <!-- parallax -->
        <script type="text/javascript" src="js/jquery.stellar.min.js"></script>

        <!-- waypoint -->
        <script type="text/javascript" src="js/waypoints.min.js"></script>

        <!-- load page Javascript -->
        <script type="text/javascript" src="js/theme-scripts.js"></script>
        <script type="text/javascript" src="js/scripts.js"></script>

        <script type="text/javascript">
            tjq(document).ready(function() {
                tjq('.revolution-slider').revolution(
                        {
                            dottedOverlay: "none",
                            delay: 8000,
                            startwidth: 1170,
                            startheight: 646,
                            onHoverStop: "on",
                            hideThumbs: 10,
                            fullWidth: "on",
                            forceFullWidth: "on",
                            navigationType: "none",
                            shadow: 0,
                            spinner: "spinner4",
                            hideTimerBar: "on",
                        });
            });
        </script>
    </body>
</html>
